Letter Combinations of a Phone Number

Question

You are given a string of digits from 2-9 (inclusive), where each digit is mapped to letters based on this phone keypad layout:

Meeting Rooms I Example 1

Generate all unique combinations of letters that can be formed by pressing these digits on the keypad.

Input: digits = "65"

Output: ["mj", "mk", "ml", "nj", "nk", "nl", "oj", "ok", "ol"]

4 can represent "m", "n", or "o" while 5 can represent "j", "k", or "l".

Input: digits = "9"

Output: ["w", "x", "y", "z"]

4 can represent "w", "x", "y", "z".

Clarify the problem

What are some questions you'd ask an interviewer?

Understand the problem

How many unique combinations are there when digits = "59"?
5
7
9
12

Login or signup to save your code.

Notes